(function (G) {
    G.vue({
        data: {
            jinji:G.Storage.get("APIURL")+'/file/1594613070485917696',
            locatIcon: G.Storage.get("APIURL") + '/file/1593488692939460608',
            selectIndex: 0,
            status: ['待反馈', '已完成', ],
            allCase: '',
            baseUrl: G.Storage.get("APIURL")
        },
        methods: {
            getAllCase() {
                // 获取指派的案件
                G.get('/api/model/g_case', {
                    dispatchUser: {$regex:'.*?'+G.Storage.get('userInfo').userId+'.*?'},
                    status: 2
                    // {
                    //     $in: [2]
                    // }
                }).then(res => {
                    console.log(res);
                    res.forEach(param => {
                        if (param.img) {
                            param.img = param.img.split(',')
                        } else {
                            param.img = ['/file/1594593721494671360']
                        }
                    })
                    this.setData({
                        allCase: res
                    })
                })
            },
            getSolveCase() {
                // 获取指派的案件
                G.get('/api/model/g_case', {
                    dispatchUser: G.Storage.get('userInfo').userId,
                    status: {
                        $in: [3,4,5,6,7,8,9]
                    }
                }).then(res => {
                    console.log(res);
                    res.forEach(param => {
                        if (param.img) {
                            param.img = param.img.split(',')
                        } else {
                            param.img = ['/file/1594593721494671360']
                        }
                    })
                    this.setData({
                        allCase: res
                    })
                })
            },
            switchTab(e) {
                console.log('----e', e.currentTarget.dataset.index);
                this.setData({
                    selectIndex: e.currentTarget.dataset.index
                })
                if (e.currentTarget.dataset.index == 0) {
                    this.getAllCase()
                } else {
                    this.getSolveCase()
                }
            }
        },
        mounted() {
            this.getAllCase()
        }
    })
})(wx.$)